#ifndef PILHADDE_HPP_
#define PILHADDE_HPP_

#include "pilha.hpp"

template <class T>
class pilhaDDE : private pilha<T>
{
public:
	void
	empilha(const T);
	
	bool
	desempilha(T&);
	
	bool
	buscaTopo(T&);
	
	bool
	alteraTopo(const T);
	
	bool
	testaVazia(void);
	
	void
	reinicia(void);
	
};

/***********************************************
 * 
 *        Implementations...
 * 
 * *********************************************/

template <class T> void
pilhaDDE<T>::empilha(const T _info)
{
	this->push(_info);
}

template <class T> bool
pilhaDDE<T>::desempilha(T &_info)
{
	try
	{
		_info = this->getInfo();
		this->pop();
	}
	catch(error e)
	{
		return false;
	}
	return true;
}

template <class T> bool
pilhaDDE<T>::alteraTopo(const T _info)
{
	try
	{	
		this->pop();
		this->push(_info);
	}
	catch(error e)
	{
		return false;
	}
	return true;
}

template <class T> bool
pilhaDDE<T>::buscaTopo(T &_info)
{
	try
	{
		_info = this->getInfo();
	}
	catch(error e)
	{
		return false;
	}
	return true;	
}

template <class T> bool
pilhaDDE<T>::testaVazia(void)
{
	return this->isEmpty();
}

template <class T> void
pilhaDDE<T>::reinicia(void)
{
	this->clear();
}

#endif /*PILHADDE_HPP_*/
